import Home from '@/components/layout/Home'
import Index from '@/components/views/Index'

const Chart = () => import('@/components/views/Chart')
const NotFound = () => import('@/components/pages/NotFound')
const Register = () => import('@/components/pages/Register')
const E404 = () => import('@/components/pages/E404')
const Icon = () => import('@/components/pages/Icon')
const Login = () => import('@/components/pages/Login')
const Table = () => import('@/components/views/Table')
const UserList = () => import('@/components/views/UserList')
const UserInfo = () => import('@/components/views/UserInfo')
const List = () => import('@/components/views/List')
const Filter = () => import('@/components/pages/Filter')

const routes = [
  {
    path: '/',
    name: 'home',
    component: Home,
    redirect: '/index',
    children: [  // 所有只有一级的导航放到这里，并指定level=1
      {
        path: '/index',
        name: 'Index',
        component: Index,
        icon: 'icon-wujiaoxing',
        level: 1,
        meta: {
          title: '首页',
          requiredAuth: true, // 是否需要登录
          search: false // 是否可搜索
        }
      },
      {
        path: '/chart',
        name: 'Chart',
        component: Chart,
        meta: {
          title: 'echart',
          requiredAuth: true
        }
      },
      {
        path: '/list',
        name: 'List1',
        component: List,
        meta: {
          title: '列表',
          requiredAuth: true, // 是否需要登录
          search: true // 是否可搜索
        }
      },
      {
        path: '/userInfo',
        name: 'UserInfo',
        component: UserInfo,
        icon: 'icon-addpeople_fill',
        meta: {
          title: '用户信息',
          requiredAuth: true
        }
      },
      {
        path: '/userList',
        name: 'UserList',
        component: UserList,
        meta: {
          title: '用户列表',
          requiredAuth: true
        }
      },
      {
        path: '/table',
        name: 'Table',
        component: Table
      },
      {
        path: '/icon',
        name: 'Icon',
        component: Icon,
        meta: {
          title: '图标',
          requiredAuth: true
        }
      },
      {
        path: '/filter',
        name: 'Filter',
        component: Filter,
        meta: {
          title: '过滤器',
          requiredAuth: true
        }
      },
      {
        path: '/notFound',
        name: 'NotFound',
        component: NotFound,
        meta: {
          title: 'NotFound',
          requiredAuth: true
        }
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: Login,
    meta: {
      title: '登录',
      requiredAuth: false
    }
  },
  {
    path: '/register',
    name: 'Register',
    component: Register,
    meta: {
      title: '注册',
      requiredAuth: false
    }
  },
  {
    path: '/error404',
    name: '404',
    component: E404,
    meta: {
      title: 'E404',
      requiredAuth: false
    }
  },
  {
    path: '*',
    redirect: '/notFound'
  }

]

export default routes
